package com.wiim.adapter;

import java.util.ArrayList;
import java.util.List;

import com.wiim.nhapnhap.R;

import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;

public class ListAdapter extends BaseAdapter  {
	public ArrayList<String> itemList;
	Animation animation = null;

	private Activity ac;

	public ListAdapter(Activity context, ArrayList<String> countryList) {
		this.itemList = new ArrayList<String>(countryList);
		ac = context;
	}

	private class ViewHolder {
		TextView tvsttValue;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final ViewHolder holder;
		// View view = null;
		if (convertView == null) {
			holder = new ViewHolder();
			LayoutInflater inflater = LayoutInflater.from(ac);
			convertView = inflater.inflate(R.layout.list_item, null);
			holder.tvsttValue = (TextView) convertView.findViewById(R.id.product_name);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		try {

			holder.tvsttValue.setText(itemList.get(position));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return convertView;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return itemList.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return itemList.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}


}
